package com.sip.stream.utils.zfy;

import android.media.MediaCodec;
import java.nio.ByteBuffer;

public class GSMediaSampleData {
    private MediaCodec.BufferInfo bufferInfo;
    private ByteBuffer byteBuf;
    private boolean isAudio = false;

    public static GSMediaSampleData createVideoSampleData(ByteBuffer byteBuffer, MediaCodec.BufferInfo bufferInfo) {
        GSMediaSampleData gSMediaSampleData = new GSMediaSampleData();
        gSMediaSampleData.isAudio = false;
        gSMediaSampleData.byteBuf = byteBuffer;
        gSMediaSampleData.bufferInfo = bufferInfo;
        return gSMediaSampleData;
    }

    public static GSMediaSampleData createAudioSampleData(ByteBuffer byteBuffer, MediaCodec.BufferInfo bufferInfo) {
        GSMediaSampleData gSMediaSampleData = new GSMediaSampleData();
        gSMediaSampleData.isAudio = true;
        gSMediaSampleData.byteBuf = byteBuffer;
        gSMediaSampleData.bufferInfo = bufferInfo;
        return gSMediaSampleData;
    }

    public long getPresentationTimeUs() {
        return this.bufferInfo.presentationTimeUs;
    }

    public String toString() {
        StringBuilder append = new StringBuilder().append(getClass().getName()).append(" isAudio = ").append(this.isAudio ? "true" : "false").append(" byteBuf = ");
        ByteBuffer byteBuffer = this.byteBuf;
        String str = null;
        StringBuilder append2 = append.append(byteBuffer == null ? null : byteBuffer.toString()).append(" bufferInfo = ");
        if (this.bufferInfo != null) {
            str = "[size = " + this.bufferInfo.size + " offset = " + this.bufferInfo.offset + "flags" + this.bufferInfo.flags + "]";
        }
        return append2.append(str).toString();
    }

    public MediaCodec.BufferInfo getBufferInfo() {
        return this.bufferInfo;
    }

    public ByteBuffer getByteBuf() {
        return this.byteBuf;
    }

    public boolean isAudio() {
        return this.isAudio;
    }

    public void setAudio(boolean isAudio) {
        this.isAudio = isAudio;
    }

    public void setBufferInfo(MediaCodec.BufferInfo bufferInfo) {
        this.bufferInfo = bufferInfo;
    }

    public void setByteBuf(ByteBuffer byteBuffer) {
        this.byteBuf = byteBuffer;
    }
}
